package com.netmarch.api.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@Api(value = "用户模块")
@RestController
@RequestMapping("/user")
public class UserController {
	/**
     * 获取单个用户
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "获取单个用户", notes = "传入id获取单个用户")
    //@ApiImplicitParam(name = "id", value = "用户id", required = true, paramType = "path", dataType = "Long") //注意：paramType需要指定为path,不然不能正常获取
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String user(@ApiParam(value = "用户Id", required = true) @PathVariable Long id) {
        return "user id :" + id;
    }
    
    /**
     * 获取用户列表
     *
     * @return
     */
    @ApiOperation(value = "获取用户列表", notes = "获取用户列表")
    @RequestMapping(value = "", method = RequestMethod.GET)
    public List list() {
        List list = new ArrayList();
        list.add("Sam1");
        list.add("Sam2");
        list.add("Sam3");
        return list;
    }
}
